{% extends 'myadmin/index.html' %}
{% block title %}
<title>后台-会员添加</title>
{% endblock %}
{% block main %}
<div class="row-content am-cf">
<script type="text/javascript" src="/static/myadmin/js/jquery.min.js"></script>
  <div class="row">
    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
      <div class="widget am-cf">
        <div class="widget-head am-cf">
          <div class="widget-title am-fl">线条表单</div>
          <div class="widget-function am-fr">
            <a href="javascript:;" class="am-icon-cog"></a>
          </div>
          <a href="{% url 'myadmin_user_index' %}?p={{request.GET.p}}&types={{request.GET.types}}&textVal={{request.GET.textVal}}" class="am-btn am-btn-default am-btn-success" style="margin-left: 50px">
                    <span class="am-icon-plus"></span>返回</a>
        </div>
        <div class="widget-body am-fr">
          <form class="am-form tpl-form-line-form" action="{% url 'myadmin_user_add' %}" method="post" enctype="multipart/form-data">
          {% csrf_token %}
            <div class="am-form-group">
              <label for="user-name" class="am-u-sm-3 am-form-label">用户名
                <span class="tpl-form-line-small-title"></span></label>
              <div class="am-u-sm-9">
                <input type="text" class="tpl-form-input"placeholder="请输入用户名" name='username'>
                <small></small></div>
            </div>
            <div class="am-form-group">
              <label for="user-name" class="am-u-sm-3 am-form-label">密码
                <span class="tpl-form-line-small-title"></span></label>
              <div class="am-u-sm-9">
                <input type="password" class="tpl-form-input"  placeholder="请输入密码" name="password">
                <small></small></div>
            </div>
            <div class="am-form-group">
              <label for="user-name" class="am-u-sm-3 am-form-label">手机号
                <span class="tpl-form-line-small-title"></span></label>
              <div class="am-u-sm-9">
                <input type="text" class="tpl-form-input" placeholder="请输入手机号" name="phone">
                <small></small></div>
            </div>
            <div class="am-form-group">
              <label for="user-name" class="am-u-sm-3 am-form-label">邮箱
                <span class="tpl-form-line-small-title"></span></label>
              <div class="am-u-sm-9">
                <input type="text" class="tpl-form-input" placeholder="请输入邮箱" name="email">
                <small></small></div>
            </div>
            <div class="am-form-group">
              <label for="user-name" class="am-u-sm-3 am-form-label">年龄
                <span class="tpl-form-line-small-title"></span></label>
              <div class="am-u-sm-9">
                <input type="text" class="tpl-form-input" id="" placeholder="请输入用户名" name="age">
                <small></small></div>
            </div>
            <div class="am-form-group">
              <label for="user-name" class="am-u-sm-3 am-form-label">性别
                <span class="tpl-form-line-small-title"></span></label>
              <div class="am-u-sm-9">
                <label class="am-radio-inline"><input type="radio" value="1" name="sex"> 男</label>
                <label class="am-radio-inline"><input type="radio" value="0" name="sex"> 女</label>
                <small></small>
              </div>
              </div>
  			  <div class="am-form-group">
                            <label for="user-weibo" class="am-u-sm-3 am-form-label">
                                头像
                            </label>
                            <div class="am-u-sm-9">
                                <div class="am-form-group am-form-file">
                                    <div class="tpl-form-file-img">
                                        <img src="/static/myadmin/img/default.jpg" alt="" width="200" id="imgs"></div>
                                    <button type="button" class="am-btn am-btn-danger am-btn-sm">
                                        <i class="am-icon-cloud-upload"></i>添加头像图片</button>
                                    <input name="pic_url" id="doc-form-file" type="file" multiple="" onchange="up(this)"></div>
                            </div>
                            <script type="text/javascript">
                            function up(pram){
                                  var file = pram.files[0];
                             if (window.FileReader) {    
                                      var reader = new FileReader();    
                                      reader.readAsDataURL(file);    
                                      //监听文件读取结束后事件    
                                    reader.onloadend = function (e) {
                                      $("#imgs").attr("src",e.target.result);    //e.target.result就是最后的路径地址
                                      };    
                                 } 
                            }
                            </script>
                </div>
            <div class="am-form-group">
              <div class="am-u-sm-9 am-u-sm-push-3">
                <button class="am-btn am-btn-primary tpl-btn-bg-color-success ">提交</button></div>
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
{% endblock %}